package com.heather.exam.models.certificate;

import java.util.ArrayList;
import java.util.List;

public class CertificateVerification {
    private int passScore;
    private List<Student> students;

    public CertificateVerification(int passScore) {
        this.passScore = passScore;
        this.students = new ArrayList<>();
    }

    // 添加学生
    public void addStudent(Student student) {
        students.add(student);
    }

    // 获取符合条件的学生列表
    public List<Student> getQualifiedStudents() {
        List<Student> qualifiedStudents = new ArrayList<>();
        for (Student student : students) {
            if (student.getScore() > 90) {//设置及格分数线
                qualifiedStudents.add(student);
            }
        }
        return qualifiedStudents;
    }

    // 生成证书
    public void generateCertificates() {
        List<Student> qualifiedStudents = getQualifiedStudents();
        for (Student student : qualifiedStudents) {
            String certificateContent = "恭喜你获得优秀学生称号";
            System.out.println(student.getName() + "，" + certificateContent);
        }
    }
}
